using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using SprentCMS.Core.Models.ViewDatas;

namespace SprentCMS.Web.Controllers
{
    public class BaseController : Controller
    {
        protected override void OnActionExecuting(ActionExecutingContext filterContext) {
            base.OnActionExecuting(filterContext);
        }

        protected override void OnResultExecuting(ResultExecutingContext filterContext) {
            if (ViewData.Model is IBaseModuleViewData) {
                IBaseModuleViewData baseViewData = ViewData.Model as IBaseModuleViewData;
                baseViewData.TemplateName = "Default";
                baseViewData.Modules = baseViewData.Modules ?? new Dictionary<string,List<ModuleBase>>();
                baseViewData.CurrentMenuItem = "Home";
            }

            base.OnResultExecuting(filterContext);
        }
    }
}
